<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>Promise testDemo</title>
	<style type="text/css">
	* {
		padding: 0;
		margin: 0;
	}

</style>
</head>
<body>
	<h1>aaaa</h1>
	<div id="box">
		<h2>第九章 闭包与作用域</h2>
		<button>收藏课程</button>
	</div>
</body>
<script src="index.js"></script>
<script type="text/javascript"> 
	async function p1() {
		return new Promise(resolve => {
			setTimeout(() => {
				console.log("houdunren");
				resolve();
			}, 2000);
		});
	}
	async function p2() {
		return new Promise(resolve => {
			setTimeout(() => {
				console.log("hdcms");
				resolve();
			}, 2000);
		});
	}
	async function hd() {
		console.log('----------start-------------\n')
		
		let r1=  p1();
		console.log('r1')
		
		let r2=  p2();
		console.log('r2')

		await r1;
		console.log('await r1')

		await r2;
		console.log('await r2')
	}
	hd();
</script>
</html>